package t4tools.lepath.generate.visitor;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;

import t4tools.lepath.model.Clazz;

public class ClassAnnotationReader extends AnnotationVisitor {

	private class ArrayVisitor extends AnnotationVisitor {
		public ArrayVisitor() {
			super(Opcodes.ASM4);
		}

		@Override
		public void visit(String name, Object value) {
			clazz.getIgnoredFieldNames().add((String) value);
		}
	}

	public ClassAnnotationReader(Clazz clazz) {
		super(Opcodes.ASM4);
		this.clazz = clazz;
	}

	private Clazz clazz;

	@Override
	public AnnotationVisitor visitArray(String name) {
		return new ArrayVisitor();
	}

	public Clazz getClazz() {
		return clazz;
	}

	public void setClazz(Clazz clazz) {
		this.clazz = clazz;
	}
}
